﻿@model Enter.Admin.Entities.Employ
@{
    ViewData["Title"] = "个人资料";
}
@section Styles {
}
@section Scripts {    
    <script src="~/plugins/parsleyjs/dist/parsley.min.js"></script>
    <script src="~/plugins/parsleyjs/dist/i18n/zh_cn.extra.js"></script>
    <script src="~/plugins/parsleyjs/dist/i18n/zh_cn.js"></script>
    <script>
        var edit = function () {
            if (!$('#form-home-profile').parsley().validate()) return;
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "@Url.Action("Profile", "User")",
                data: $("#form-home-profile").serialize(),
                success: function (result) {
                    if (result.Success) {
                        show_alert('success', result.Message)
                    } else {
                        show_alert('warning', result.Message)
                    }
                },
                error: function (e) {
                    show_alert('error', '网络异常.')
                }
            });
        }
        $(document).ready(function () {
            $('#form-save-button').click(function () {
                edit();
            })
        });
    </script>
}
<div class="profile-content">
    <!-- begin #profile-about tab -->
    <div class="tab-pane fade active show" id="profile-about">
        <!-- begin table -->
        <div class="table-responsive form-inline">
            <form asp-action="Profile" id="form-home-profile">
                <table class="table table-profile">
                    <thead>
                        <tr>
                            <th></th>
                            <th>
                                <h4>@Model.TrueName <small>@Model.Role.RoleName</small></h4>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr class="highlight">
                            <td class="field">用户名</td>
                            <td>@Model.UserName</td>
                        </tr>
                        <tr class="highlight">
                            <td class="field">姓名</td>
                            <td>@Model.TrueName</td>
                        </tr>
                        <tr class="divider">
                            <td colspan="2"></td>
                        </tr>
                        <tr>
                            <td class="field" style="vertical-align:middle;">手机</td>
                            <td>
                                <div class="input-group">
                                    <div class="input-group-prepend"><span class="input-group-text"><i class="fa fa-mobile fa-lg m-r-5"></i></span></div>
                                    <input asp-for="Phone" class="form-control" data-parsley-pattern="/^1[0-9]{10}$/" data-parsley-pattern-message="请输入正确的手机号码" />
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="field" style="vertical-align:middle;">邮箱</td>
                            <td>
                                <div class="input-group">
                                    <div class="input-group-prepend"><span class="input-group-text"><i class="fa fa-envelope fa-lg m-r-5"></i></span></div>
                                    <input asp-for="Email" class="form-control" data-parsley-type="email" />
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="field" style="vertical-align:middle;">密码</td>
                            <td>
                                <div class="input-group">
                                    <div class="input-group-prepend"><span class="input-group-text"><i class="fa fa-key fa-lg m-r-5"></i></span></div>
                                    <input type="password" id="Password" name="Password" placeholder="密码为空则不修改" class="form-control" data-parsley-minlength="6" />
                                </div>
                            </td>
                        </tr>                                     
                        <tr class="divider">
                            <td colspan="2"></td>
                        </tr>
                        <tr class="highlight">
                            <td class="field">&nbsp;</td>
                            <td class="p-t-10 p-b-10">
                                <input id="form-save-button" type="button" class="btn btn-primary width-150" value="保存" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>
        </div>
        <!-- end table -->
    </div>
    <!-- end #profile-about tab -->
</div>